<template>
  <div>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <!-- <el-tab-pane label="统一设置" name="first"> -->
      <!-- <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span>抽成比例设置</span>
            <el-button
              style="float: right; padding: 5px 10px"
              type="primary"
              @click="submitScale()"
            >保存</el-button>
          </div>
          <el-form :label-position="labelPosition" label-width="250px" :model="scaleSet">
            <el-form-item label="VIP一级抽成比例（%）:">
              <el-input-number
                style="width:125px"
                controls-position="right"
                v-model="scaleSet.buyCourseL1Ratio"
                :min="0"
                :max="99"
              ></el-input-number>%
            </el-form-item>
            <el-form-item label="VIP推vip一次性抽成（%）:">
              <el-input-number
                style="width:125px"
                controls-position="right"
                v-model="scaleSet.upgradeMembershipL1Ratio"
                :min="0"
                :max="99"
              ></el-input-number>%
      </el-form-item>-->
      <!-- <el-form-item label="VIP商品折扣:">
              <el-input-number
                style="width:125px"
                controls-position="right"
                v-model="scaleSet.buyDiscount"
                :min="0"
                :max="10"
              ></el-input-number>%
      </el-form-item>-->
      <!-- <el-form-item label="合伙人一级抽成比例（%）:">
              <el-input-number
                style="width:125px"
                controls-position="right"
                v-model="scaleSet.partnerDiscount"
                :min="0"
                :max="99"
              ></el-input-number>%
            </el-form-item>
            <el-form-item label="运营中心一级抽成比例（%）:">
              <el-input-number
                style="width:125px"
                controls-position="right"
                v-model="scaleSet.runDiscount"
                :min="0"
                :max="99"
              ></el-input-number>%
            </el-form-item>
            <el-form-item label="分公司一级抽成比例（%）:">
              <el-input-number
                style="width:125px"
                controls-position="right"
                v-model="scaleSet.companyDiscount"
                :min="0"
                :max="99"
              ></el-input-number>%
            </el-form-item>
          </el-form>
      </el-card>-->

      <el-card>
        <div slot="header" class="clearfix">
          <span>代理商设置</span>
          <el-button
            type="primary"
            style="float: right; padding: 5px 10px"
            @click="submitScale()"
          >保存</el-button>
        </div>
        <el-form :label-position="labelPosition" label-width="160px" v-model="scaleSet">
          <el-row>
            <el-col :span="12">
              <p>合伙人设置：</p>
              <br />
              <br />
              <el-form-item label="充值金额:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.partnerMoney"
                  controls-position="right"
                ></el-input-number>元
              </el-form-item>
              <el-form-item label="赠送钻石VIP数量:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.partnerNumber"
                  controls-position="right"
                ></el-input-number>个
              </el-form-item>
              <el-form-item label="赠送线下活动门票数:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.partnerActivate"
                  controls-position="right"
                ></el-input-number>个
              </el-form-item>
              <el-form-item label="赠送激活卡数量:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.partnerCard"
                  controls-position="right"
                ></el-input-number>个
              </el-form-item>
              <el-form-item label="发展下线人数达标值:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.partnerTask"
                  controls-position="right"
                ></el-input-number>人
              </el-form-item>
              <el-form-item label="发展下线达标提成:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.partnerTaskMoney"
                  controls-position="right"
                ></el-input-number>%
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <p>事业部设置：</p>
              <br />
              <br />
              <el-form-item label="充值金额:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.runMoney"
                  controls-position="right"
                ></el-input-number>元
              </el-form-item>
              <el-form-item label="赠送钻石VIP数量:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.runMumber"
                  controls-position="right"
                ></el-input-number>个
              </el-form-item>
              <el-form-item label="赠送线下活动门票数:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.runActivate"
                  controls-position="right"
                ></el-input-number>个
              </el-form-item>
              <el-form-item label="赠送激活卡数量:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.runCard"
                  controls-position="right"
                ></el-input-number>个
              </el-form-item>
              <el-form-item label="发展下线人数达标值:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.runTask"
                  controls-position="right"
                ></el-input-number>人
              </el-form-item>
              <el-form-item label="发展下线达标提成:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.runTaskMoney"
                  controls-position="right"
                ></el-input-number>%
              </el-form-item>
              <el-form-item label="赠送合伙人数量:">
                <el-input-number
                  style="width:150px"
                  v-model="scaleSet.partner"
                  controls-position="right"
                ></el-input-number>个
              </el-form-item>
            </el-col>
          </el-row>
          <br />
          <el-form-item label="vip下载资料次数:">
            <el-input-number
              style="width:150px"
              v-model="scaleSet.pointsVip"
              controls-position="right"
            ></el-input-number>个
          </el-form-item>
          <el-form-item label="普通用户下载资料次数:">
            <el-input-number
              style="width:150px"
              v-model="scaleSet.points"
              controls-position="right"
            ></el-input-number>个
          </el-form-item>
        </el-form>
        <br />

        <!-- <el-form-item label="直接推广VIP（用完赠送vip后的分成比例）:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.partnerNumbers"
                controls-position="right"
              ></el-input-number>%
            </el-form-item>
            <el-form-item label="协助平台招商（合伙人、运营中心、分公司）一次性分成:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.partnerAssist"
                controls-position="right"
              ></el-input-number>%
            </el-form-item>

            <el-form-item label="旗下vip推vip分成比例:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.partnerVip"
                controls-position="right"
              ></el-input-number>%
        </el-form-item>-->

        <!-- <el-form-item label="直接推广VIP（用完赠送vip后的分成比例）:">
            <el-input-number
              style="width:150px"
              v-model="scaleSet.runMumbers"
              controls-position="right"
            ></el-input-number>%
        </el-form-item>-->
        <!-- <el-form-item label="协助平台招商（合伙人、运营中心、分公司）一次性分成:">
            <el-input-number
              style="width:150px"
              v-model="scaleSet.runAssist"
              controls-position="right"
            ></el-input-number>%
          </el-form-item>
          <el-form-item label="旗下团队推广vip收益比例:">
            <el-input-number
              style="width:150px"
              v-model="scaleSet.runDifference"
              controls-position="right"
            ></el-input-number>%
          </el-form-item>
          <el-form-item label="旗下vip推vip分成比例:">
            <el-input-number
              style="width:150px"
              v-model="scaleSet.runVip"
              controls-position="right"
            ></el-input-number>%
        </el-form-item>-->

        <!-- <p>分公司设置：</p>
            <el-form-item label="充值金额:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.companyMoney"
                controls-position="right"
              ></el-input-number>元
            </el-form-item>
            <el-form-item label="赠送VIP数量:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.companyNumber"
                controls-position="right"
              ></el-input-number>个
            </el-form-item>
            <el-form-item label="直接推广VIP（用完赠送vip后的分成比例）:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.companyNumbers"
                controls-position="right"
              ></el-input-number>%
            </el-form-item>
            <el-form-item label="协助平台招商（合伙人、运营中心、分公司）一次性分成:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.companyAssist"
                controls-position="right"
              ></el-input-number>%
            </el-form-item>
            <el-form-item label="旗下团队推广vip收益比例:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.partnerDifference"
                controls-position="right"
              ></el-input-number>%
            </el-form-item>
            <el-form-item label="旗下vip推vip分成比例:">
              <el-input-number
                style="width:150px"
                v-model="scaleSet.companyVip"
                controls-position="right"
              ></el-input-number>%
        </el-form-item>-->
        <table cellpadding="0" cellspacing="0" class="set">
          <tr align="center">
            <td></td>
            <td>一级分成</td>
            <td>二级分成</td>
          </tr>
          <tr align="center">
            <td rowspan="2">
              <p>合伙人</p>
            </td>
            <td>
              <span>零售</span>
              <el-input-number
                style="width:150px"
                controls-position="right"
                v-model="scaleSet.partnerDiscount"
              ></el-input-number>%
            </td>
            <td>
              <span>零售</span>
              <el-input-number
                style="width:150px"
                controls-position="right"
                v-model="scaleSet.partnerVip"
              ></el-input-number>%
            </td>
          </tr>
          <tr align="center">
            <td>
              <span>招商</span>
              <el-input-number
                style="width:150px"
                controls-position="right"
                v-model="scaleSet.partnerAssist"
              ></el-input-number>%
            </td>
            <td>
              <span>招商</span>
              <el-input-number
                style="width:150px"
                controls-position="right"
                v-model="scaleSet.partnerAssists"
              ></el-input-number>%
            </td>
          </tr>
          <tr align="center">
            <td rowspan="2">
              <p>事业部</p>
            </td>
            <td>
              <span>零售</span>
              <el-input-number
                style="width:150px"
                controls-position="right"
                v-model="scaleSet.runDiscount"
              ></el-input-number>%
            </td>
            <td>
              <span>零售</span>
              <el-input-number
                style="width:150px"
                controls-position="right"
                v-model="scaleSet.runrunVip"
              ></el-input-number>%
            </td>
          </tr>
          <tr align="center">
            <td>
              <span>招商</span>
              <el-input-number
                style="width:150px"
                controls-position="right"
                v-model="scaleSet.runAssist"
              ></el-input-number>%
            </td>
            <td>
              <span>招商</span>
              <el-input-number
                style="width:150px"
                controls-position="right"
                v-model="scaleSet.runAssists"
              ></el-input-number>%
            </td>
          </tr>
        </table>
      </el-card>

      <!-- <el-tab-pane label="定时任务补偿" name="fourth">定时任务补偿</el-tab-pane> -->
    </el-tabs>
  </div>
</template>
<script>
import { proportion, unification } from "@/api/member";
export default {
  data() {
    return {
      activeName: "first",
      labelPosition: "left",

      scaleSet: {
        partnerMoney: "",
        partnerNumber: "",
        partnerActivate: "",
        partnerCard: "",
        partnerTask: "",
        partnerTaskMoney: "",
        runMoney: "",
        runMumber: "",
        runActivate: "",
        runCard: "",
        runTask: "",
        runTaskMoney: "",
        partner: "",
        partnerDiscount: "",
        partnerVip: "",
        partnerAssist: "",
        partnerAssists: "",
        runDiscount: "",
        runrunVip: "",
        runAssist: "",
        runAssists: "",
        pointsVip: "",
        points: ""
      }
    };
  },
  watch: {
    scaleSetDistribution(val) {
      console.log(val);
    }
  },
  methods: {
    submitScale() {
      unification(this.scaleSet).then(res => {
        console.log(res);
      });
      this.getScale();
    },
    handleClick() {},
    getScale() {
      proportion().then(res => {
        console.log(res);
        var data = res.data.data;
        this.scaleSet = {
          partnerMoney: data.partnerMoney,
          partnerNumber: data.partnerNumber,
          partnerActivate: data.partnerActivate,
          partnerCard: data.partnerCard,
          partnerTask: data.partnerTask,
          partnerTaskMoney: data.partnerTaskMoney,
          runMoney: data.runMoney,
          runMumber: data.runMumber,
          runActivate: data.runActivate,
          runCard: data.runCard,
          runTask: data.runTask,
          runTaskMoney: data.runTaskMoney,
          partner: data.partner,
          partnerDiscount: data.partnerDiscount,
          partnerVip: data.partnerVip,
          partnerAssist: data.partnerAssist,
          partnerAssists: data.partnerAssists,
          runDiscount: data.runDiscount,
          runrunVip: data.runrunVip,
          runAssist: data.runAssist,
          runAssists: data.runAssists,
          pointsVip: data.pointsVip,
          points: data.points
        };
      });
    }
  },
  mounted() {
    this.getScale();
  }
};
</script>
<style scoped>
.set {
  width: 80%;
  border: 1px solid #ccc;
}
.set tr td {
  border: 0.25px solid #ccc;
  padding: 10px;
}
</style>
